﻿<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
		<meta name="apple-mobile-web-app-capable" content="yes" />
		<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
		<meta name="apple-mobile-web-app-title" content="思路广惠">
		<title>个人资料修改</title>

		<meta content="telephone=no" name="format-detection" />

		<link rel="stylesheet" type="text/css" href="../../src/css/base.css?1.0" />
	</head>

	<body class="body-bg">
		<header class="header">
			<a href="javascript: history.go(-1)" class="head-le"><i class="iconfont icon-fanhui i2m"></i></a>
			<h1 class="header-txt" id="headtxt"> </h1>
		</header>
		<section class="top1rem">
			<input class="own-amend w100" type="text" id="changeVal" placeholder="请输入" />
			<div class="own-save">
				<button class="own-save-btn" id="subChange" type="button">
                提交
            </button>
			</div>
		</section>
		<script src="//cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
		<script src="//cdn.bootcss.com/layer/3.0.1/mobile/layer.js"></script>
		<script src="../../src/js/all.js" type="text/javascript" charset="utf-8"></script>
		<script>
			
			var headarr = ['修改会员名', '修改身份证', '修改邮箱', '修改详细地址'],
					modeval = silks.getByVal("flag"),
					getChange = function(mode, val) {
						var data = {
							MembersID: MembersID,
							Mode: mode,
							NewContact: val,
							AppID: AppID,
							Token: Token
						}
						$.post(urls + "/WorkMembers/MembersEditByMode", data, function(res) {
							console.log(res)
							if(res.Return_ID == 0) {
								layers(res.Return_Mess, function() { 
									history.go(-1);
								})
							} else {
								layers(res.Return_Mess)
							}
						});
					};
				$("#headtxt").html(headarr[modeval]); // 头部对应修改信息提示

				$("#subChange").click(function() {
					var vals = $("#changeVal").val();
					if(vals) {
						if(modeval == 0) {
							getChange("MembersName", vals);
						} else if(modeval == 1) {
							if(vals.length === 18) {
								getChange("CardID", vals);
							} else {
								layers("请输入正确身份证号")
							}

						} else if(modeval == 2) {
							if(!/^(\w-*\.*)+@(\w-?)+(\.\w{2,})+$/.test(vals)) {
								getChange("Email", vals);
							}
							else {
								layers("请输入正确邮箱")
							}
						} else if(modeval == 3) {
							if(vals.length >= 5) {
								getChange("Address", vals);
							} else {
								layers("请输入至少5个字符")
							}
						}
					} else {
						layers("请输入正确信息")
					}
				});

		</script>
	</body>

</html>